package com.damai.param;

import com.damai.error.ApiError;

public abstract class AbsParamValidate implements IParamValidate {

	private String message;
	
	
	public String getMessage(){
		return message;
	}
	
	public AbsParamValidate(String message) {
		this.message = message;
	}
	
	@Override
	public void validateParam(Object value) {
		if(!doValidate(value)){
			final String message = this.message;
			throw new ApiError(message);
		}
	}

	protected abstract boolean doValidate(Object value);

}
